package com.example.dps;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import com.downpayment.dps.R;


public class SetupConstraintsActivity extends Activity {
	
	ActionBarHelper actionBarHelper;
	
	@Override
	public void onConfigurationChanged(Configuration newConfig){
		super.onConfigurationChanged(newConfig);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
	}
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.setup_constraints_layout);
		
		
		Utility.adjustBackground(this);
		
		TextView constraintOne = (TextView) findViewById(R.id.constraintOne);
		
		
		this.actionBarHelper = new ActionBarHelper(this);
		
		this.actionBarHelper.makeBar();
		
		ImageButton continueButton = (ImageButton) findViewById(R.id.continueButton);
		
		continueButton.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View view) {
				
				Intent intent = new Intent(SetupConstraintsActivity.this, SetupAccountActivity.class);
				SetupConstraintsActivity.this.startActivity(intent);
				
			}
			
		});
		
		continueButton.setOnTouchListener(new OnTouchListener(){
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				ImageView view = (ImageView) v;
		    	
		        if(event.getAction() == MotionEvent.ACTION_DOWN) {
		        	/** change the image button picture when clicked **/
		        	view.setImageDrawable(v.getResources().getDrawable(R.drawable.continue_btn_clicked));
		        } else if (event.getAction() == MotionEvent.ACTION_UP) {
		        	view.setImageDrawable(v.getResources().getDrawable(R.drawable.continue_btn));
		        }
		        else if (event.getAction() == MotionEvent.ACTION_CANCEL) {
		        	view.setImageDrawable(v.getResources().getDrawable(R.drawable.continue_btn));
		        }
				return false;
			}
		});
		
		
		TextView ToSText = (TextView) findViewById(R.id.ToSText);
		
		ToSText.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				
				Intent intent = new Intent(SetupConstraintsActivity.this, ToSActivity.class);
				startActivity(intent);
			}
			
		});
		
		TextView privacyPolicyText = (TextView) findViewById(R.id.privacyPolicyText);
		
		privacyPolicyText.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				
				Intent intent = new Intent(SetupConstraintsActivity.this, PrivacyPolicyActivity.class);
				startActivity(intent);
			}
			
		});
		
		
	}

}
